<?php

class Application_Form_FrmReport extends Zend_Form
{
    public function init()
    {
   
    }
    public function salseReport($data=null)
    {
    	$db=new Application_Model_DbTable_DbGlobal();
    	$request = Zend_Controller_Front::getInstance()->getRequest();
    	
//     	$itemElement = new Zend_Form_Element_Text("item");
//     	$itemvalue = $request->getParam("item");
//     	$itemElement->setValue($itemvalue);
//     	$itemElement->setAttribs(array('placeholder'=>'Item Name,Code...'));
    	
    	$rs=$db->getGlobalDb('SELECT pro_id, item_name,p_code FROM tb_product WHERE item_name!="" ');
    	$options=array('Select Products');
    	$proValue = $request->getParam('item');
    	foreach($rs as $read) $options[$read['pro_id']]=$read['p_code']." ".$read['item_name'];
    	$pro_id=new Zend_Form_Element_Select('item');
    	$pro_id->setMultiOptions($options);
    	$pro_id->setAttribs(array(
    			'id'=>'item',
    	//		'onchange'=>'this.form.submit()'
    	));
    	$pro_id->setValue($proValue);
    	$this->addElement($pro_id);
    	
    	
    	$rs=$db->getGlobalDb('SELECT DISTINCT Name,LocationId FROM tb_sublocation WHERE Name!="" AND status=1 ');
    	$options=array('Please Select Location');
    	$locationValue = $request->getParam('LocationId');
    	foreach($rs as $read) $options[$read['LocationId']]=$read['Name'];
    	$location_id=new Zend_Form_Element_Select('LocationId');
    	$location_id->setMultiOptions($options);
    	$location_id->setAttribs(array(
    			'id'=>'LocationId',
    		//	'onchange'=>'this.form.submit()',
    	));
    	$location_id->setValue($locationValue);
    	
    	$date = new Zend_Date();
    	$startDate = new Zend_Form_Element_Text("start_date");
    	$startDatevalue = $request->getParam("start_date");
    	//$startDate->setAttribs(array("class"=>"validate[required]"));
    	$startDate->setValue($startDatevalue);
    	
    	$endDate = new Zend_Form_Element_Text("end_date");
    	//$endDate->setValue($date->get("DD-MM-YY"));
    	$endDatevalue = $request->getParam("start_date");
    	//$endDate->setAttribs(array("class"=>"validate[required]"));
    	$endDate->setValue($endDatevalue);

    	$this->addElements(array($startDate,$endDate,$location_id));
    	Application_Form_DateTimePicker::addDateField(array('start_date','end_date'));
     	return $this;
    
    }
	
}

